package cc.sheji.config;

import cc.sheji.domain.Device;
import cc.sheji.service.DeviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class DeviceConfig {


    public String cookie = "_ga=GA1.1.1603457927.1682155744; __Host-next-auth.csrf-token=c6ed6520843ac4eb3ba94538e0ae228f35500bc9714146c93b8b45aed3083d10|fe996427090b7bb2d01ff5455f7f7b7d86a8716da8c94efc20b5155d57e2bde4; imageSize=medium; imageLayout_2=hover; getImageAspect=2; fullWidth=false; showHoverIcons=true; __Secure-next-auth.callback-url=https://www.midjourney.com/app/; _dd_s=rum=0&expire=1682156736060; __Secure-next-auth.session-token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..E1IPuxpn1bM_h0Ut.oJ5y51zcNNCL_WpRF1YjMM20ALO1cp95nGmQywZaPT4_lK3sdw6rqUoV9ZYqTM3zk4OEBUBQXWx33L1I1V9DZaB0L38IVWDT82UF1aU58nA3P7UhW_zGZBN_33xuDo1co5nih_HNb1Npp6yJEiJeennpJnO7b_zCjoge_EO-V0iDNRzk5wD4tAYyVTpvxEPE71mq5jwClMuBUlCDBKOJbH3qORz4gmyLNm4vgJ82PAIWgEAsyAGgVZw4JCfgyB1QSox1gGv5COTR2fQwTYNputA8_CMeFZMtF60f67cNK23kzGue4xRK3Tr5u39o4dKU2RNrGHsAc5suIHzxMY1E_iTjohMV8c7ZU60uk7hjKSojmLnK_7BzihbUqUelQD_pzY0muIFRO2NxrpQhYdiK_tsemaRvTBHIzC5vaR5FFzqL9smi60TVS4WrujT7-3rIQ7M6oEME9M7Limgc6ORvVeQ8gJBb8aQdkw8hbjhQ3J5oOeVk8MXd-sj360k1R9FbLmdKbgLm57tZ57OurJuE_ekVef5hcYGHAoQ31hrkt9QWvvlMaJx54-kZoa7XRGguwigforikXkMg8qQ6lGMTb-2LwgcyJ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xOFFFKaTfqBVrULKMhdSRu81EV3U5O2j44vOBMChtQuleRYCSaT8if7fWL7OtrTddohsYylv2AMVDYxbuDi4d_DZbTMWasOxsFQosz1t9DcIqRx4J74pAD_xSsWoJ-rj7hX0I76QDHF-QMKaVoaaX2VfZ_FMSzxw9HSNwyMqmg8pG0FClddwucDqTzH_CPP1xZcvFNedCvCL0HbWqk1m9b3-FCAwyhYW-EzvmP2-sOzmkXmjPVCqgABnhtM8IEqxwuA8FRT-YCWpb3QmAUGc8qPvRyqfXBp9BdGWUe_MzaX8lj3O-btth8-JHBBzULRPbCIsRG8czdffTY9SuvRqE_8AroOkRf8cLigsSFBk0W-zQy9AMLbBS_57Gp3Ra5DVPtMuWTkshMwxeF4WCNtI1FxHKAfHC7XQ2CLpQwwpA3ObtX7beGk8lNBQxAI2r3wzxvgRrDBfT0_I4V6z50A-g1GmihqC9szT6MO6MXjmL8ijaSqm9NrSxho1_H082ebkATXCNCIloVLFwqeSIsrPILAW6lnivkyAXjv3tf4w.5OYQiJxRdOmNfXYYxm0IqA; _ga_Q0DQ5L7K0D=GS1.1.1682155744.1.1.1682155836.0.0.0";

    public String SERVER_ID = "1085105132351537152";
    public String CHANNEL_ID = "1085105132351537155";
    public String auth = "OTE4NzM0NzczMzQ0NjkwMjQ3.GWJqvw.tEIkCHT8nvbexcdRAPdkx_MQFOU6poe9SNVcU0";
    public String userId = "d2399c99-954f-41bf-869d-3f0e5c4ccd58";
    public String plateUrl ;
    public Integer productMode ;
    public String session;

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    DeviceService deviceService;

    @Value("1")
    public Long id ;

    @Value("${mode}")
    public int  mode ;

    @PostConstruct
    public void init() {
        Device device = deviceService.get(id);
        setInfo(device);
        log.info("初始化DeviceInfo");
    }

    public void setInfo(Device device) {
        this.plateUrl=device.plateUrl;
        this.userId = device.userId;
        this.cookie = device.cookie;
        this.SERVER_ID = device.SERVER_ID;
        this.CHANNEL_ID = device.CHANNEL_ID;
        this.auth = device.auth;
        this.productMode = device.productMode;
        this.session = device.session;
        System.out.println(device);
    }

}
